/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cl.orientesalud.util;

import java.io.IOException;
import java.util.Properties;
import org.apache.log4j.Logger;

/**
 *
 * @author nicolas
 */
public class Configuracion {
 
    Properties properties = null;
 
    /** Configuration file name */
    public final static String CONFIG_FILE_NAME = "configuracion.properties";
 
    /** Data base server */
    public final static String HOSTBD = "HOSTBD";
 
    /** Data base user */
    public final static String USERBD = "USERBD";
 
    /** Data base password */
    public final static String PASSBD = "PASSBD";
    
    /**Data base jdbc driver*/
    
    public final static String DRIVERBD = "DRIVERBD";
    
    public final static String RUTA_REPORTE="RUTA_REPORTE";
    
    public final static String RUTA_JASPER="RUTA_JASPER";
 
    private Configuracion() {
        Logger logger=OrienteLog.obtenerLogger(Configuracion.class);
        this.properties = new Properties();
        try {
            properties.load(Configuracion.class.getClassLoader().getResourceAsStream(CONFIG_FILE_NAME));
        } catch (IOException ex) {
            logger.error("Error al cargar configuracion:"+ex.getMessage());
        }
    }//Configuration
 
    /**
     * Implementando Singleton
     *
     * @return
     */
    public static Configuracion getInstance() {
        return ConfigurationHolder.INSTANCE;
    }
 
    private static class ConfigurationHolder {
 
        private static final Configuracion INSTANCE = new Configuracion();
    }
 
    /**
     * Retorna la propiedad de configuración solicitada
     *
     * @param key
     * @return
     */
    public String getProperty(String key) {
        return this.properties.getProperty(key);
    }//getProperty
}
